home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / TFC024.422 < prev    next >
Text File  |  1993-03-20  |  10KB  |  301 lines

  1. 2TFC024.422 1Scan And Validate Pending Messages
  2. The Flying Chicken [SysOp] #1 @12456
  3. 3Friday, March 19, 1993  1 5:54 pm
  4. TFC024.422 - Unvalidated Message Scan for SysOps
  5. Author: The Flying Chicken 1@12456 (WWIVLink) 1@2456 (WWIVNet)
  6. Source: WWIV 4.20e/WWIV 4.22
  7. Version:    2.0
  8.  
  9.     NOTE: This file is for WWIV 4.22 ONLY.  If you use 4.20e, 
  10.           e-mail me for the previous version of this mod.
  11.  
  12.     Okay folks.  This mod is probably one of the most asked-for
  13.     mods in existence, and I can't believe I've never seen anyone do
  14.     it before me.  I tried once, and got lost in the endlessly
  15.     confusing code Wayne used in MSGBASE.C and MSGBASE1.C.  However,
  16.     I think I have finally mastered the beast, and am ready to conquer
  17.     the mod.
  18.  
  19.     This mod will scan your messages bases for all NEW messages that need
  20.     to be validated (because of your user restrictions) or need to
  21.     be network validated (if you have the validation option set in
  22.     //BOARDEDIT).  It works in much the same way as the 'N', 'Q', and
  23.     '/N' message scanning commands.  To scan your bases, simply type
  24.     one of the following:
  25.  
  26.         J - Will ask if you want to scan all message bases or not.
  27.             If so, all bases will be scanned.  Otherwise, only
  28.             the current base is scanned.
  29.        /J - Scans from the current message base to the last.
  30.  
  31.     The /J command is a twin of the /N command.
  32.     The J (Scan all) is a twin of the N command.
  33.     The J (DON'T scan all) is a twin of the Q command.
  34.  
  35.     When scanning, only messages needing to be validated will be
  36.     displayed.  You can perform any function you could normally
  37.     perform while reading new messages.
  38.  
  39.     If a message needs to be validated, but has already by read
  40.     by you, the /J or J command won't pick the message up.  This is
  41.     because it starts scanning where a 'N' (New-Scan) would start.
  42.     You really don't want to scan thru every message on each base,
  43.     believe me.
  44.  
  45.     Don't bother trying to figure out why 'J', it was about the only
  46.     letter left.  (grin)
  47.  
  48.     One final note (and feature, I think) about the mod.  It will not
  49.     affect your qscan pointers.  If I didn't do this,  your qscan
  50.     pointer would point to the last message you validated, instead
  51.     of the last message you read, so you'd "lose" messages.  This way,
  52.     you can validate as many times as you want, and still go back and
  53.     do an effective N-Scan later on.
  54.  
  55.     I wrote this mod for my 4.20 source, and have no idea if it works
  56.     or not in 4.12.  However, other than the fact that Wayne now uses
  57.     the 64 subs mod, the code shouldn't have changed that much between
  58.     the two versions, so it might work okay.  If you have 4.12, and
  59.     have problems with the mod, holler, and I'll be glad to help you out.
  60.  
  61.     v2.0 - Upgrade for 4.22
  62.     v1.0 - Initial version
  63.  
  64.     Before using this or any mod, back up your source !!!!!  And while
  65.     your at it, BACK UP YOUR BBS!!!!!!  (or at least the important stuff!)
  66.  
  67.                 PKZIP source *.c *.h *.mak
  68.  
  69.  
  70.     1. Load up MSGBASE1.C.  Search for the void scan() function, and
  71.        makes these changes at the beginning of the function.
  72.  
  73. void scan(int msgnum, int optype, int *nextsub)
  74. {
  75.   char s[81],s1[81],s2[81],*b,*ss1;
  76.   int i,i1,i2,done,quit,abort,next,val,realexpress;
  77.   slrec ss;
  78.   long l,len;
  79.   postrec p,p1;
  80.   int vscan=0;                                  /* ADD */
  81.  
  82.   if (optype==3)                                /* ADD */
  83.     vscan=1;                                    /* ADD */
  84.  
  85.   irt[0]=0;
  86.   irt_name[0]=0;
  87.  
  88.  
  89.     2.  Scroll down a bit....
  90.  
  91.         if (s[0]==0) {
  92.           i=msgnum+1;
  93.           if (i>=nummsgs+1)
  94.             done=1;
  95.         }
  96.         if ((i!=0) && (i<=nummsgs) && (i>=1)) {
  97.           optype=2;
  98.           if (vscan)                                    /* ADD */
  99.             optype=3;                                   /* ADD */
  100.           msgnum=i;
  101.         } else
  102.           if (s[1]==0) {
  103.             switch(s[0]) {
  104.               case 'Q':
  105.                 quit=1;
  106.                 done=1;
  107.  
  108.  
  109.     3.  Go to step 4
  110.  
  111.     4.  And down a bit more...
  112.  
  113.               case '-':
  114.                 if ((msgnum>1) && (msgnum-1<nummsgs)) {
  115.                   --msgnum;
  116.                   optype=2;
  117.                   if (vscan)                                    /* ADD */
  118.                     optype=3;                                   /* ADD */
  119.                 }
  120.                 break;
  121.               case 'C':
  122.                 express=1;
  123.                 break;
  124.  
  125.  
  126.     5.  Keep going down, almost to the bottom.  Make
  127.         these changes:
  128.  
  129.       case 2: /* Read Message */
  130.       case 3:                                                      /* ADD */
  131.         if (optype==2)                                             /* ADD */
  132.           if ((msgnum>0) && (msgnum<=nummsgs))
  133.             read_message(msgnum,&next,&val);
  134.         if (optype==3)                                      /* ADD */
  135.           if ((msgnum>0) && (msgnum<=nummsgs) &&            /* ADD */
  136.             (msg[msgnum].status & (status_unvalidated | status_pending_net)))
  137.                 read_message(msgnum,&next,&val);  /* ADD THIS AND ABOVE LINE */
  138.           else                                              /* ADD */
  139.             next=1;                                         /* ADD */
  140.         ansic(0);
  141.         nl();
  142.         if (next) {
  143.           if (optype==3)                                            /* ADD */
  144.             while ((msgnum<=nummsgs) && (!(msgs[msgnum].status &    /* ADD */
  145.                 (status_unvalidated | status_pending_net))))        /* ADD */
  146.               ++msgnum;
  147.           else                                                      /* ADD */
  148.             ++msgnum;                                               /* ADD */
  149.           if (msgnum>nummsgs)
  150.             done=1;
  151.           optype=2;
  152.           if (vscan)                                /* ADD */
  153.             optype=3;                               /* ADD */
  154.         } else
  155.           optype=0;
  156.         if (expressabort)
  157.           if (realexpress) {
  158.             done=1;
  159.             quit=1;
  160.             *nextsub=0;
  161.           } else {
  162.             expressabort=0;
  163.             express=0;
  164.             optype=0;
  165.           }
  166.         break;
  167.     }
  168.   } while ((!done) && (!hangup));
  169.   if (!realexpress) {
  170.     express=0;
  171.     expressabort=0;
  172.   }
  173.  
  174.  
  175.     6. Search for the nscan() function, and add the following two
  176.        functions right before it.
  177.  
  178.  
  179. void vscan(int bn, int *ns)             /* ADD FUNCTION */
  180. {
  181.   int i,nextsub,os,sn,done=0;
  182.   char s[81],s1[81];
  183.   unsigned long qscnptrx;
  184.  
  185.   sn=usub[bn].subnum;
  186.  
  187.   if ((hangup) || (sn<0))
  188.     return;
  189.  
  190.   nl();
  191.  
  192.   qscnptrx=qsc_p[sn];
  193.   nextsub=*ns;
  194.   os=cursub;
  195.   cursub=bn;
  196.   i=1;
  197.  
  198.   iscan(cursub);
  199.  
  200.   sprintf(s,"< V-Scan %s %s - %u %s >", subboards[curlsub].name,
  201.             usub[cursub].keys,nummsgs, "msgs");
  202.   prt(1,s);
  203.   nl();
  204.  
  205.   while ((i<=nummsgs) && (!done))
  206.     if (msgs[i].status & (status_unvalidated | status_pending_net))
  207.       done=1;
  208.     else
  209.       ++i;
  210.  
  211.   if ((nummsgs>0) && (i<=nummsgs))
  212.     scan(i,3,&nextsub);
  213.  
  214.   cursub=os;
  215.   *ns=nextsub;
  216.   qsc_p[sn]=qscnptrx;
  217.  
  218. }
  219.  
  220. void val_scan(int ss,int all)               /* ADD FUNCTION */
  221. {
  222.   int i,nextsub,abort,next;
  223.  
  224.   nl();
  225.   nextsub=1;
  226.   if (all) {
  227.     prt(3,"<< Val-Scan All >>");
  228.     nl();
  229.   }
  230.   for (i=ss; (usub[i].subnum!=-1) && (i<num_subs) && (nextsub) && (!hangup); 
  231.                i+ +) {
  232.     vscan(i,&nextsub);
  233.     abort=next=0;
  234.     checka(&abort,&next);
  235.     if ((abort) || (!all))
  236.       nextsub=0;
  237.   }
  238.   nl();
  239.   if (all) {
  240.     prt(3,"<< Global Val-Scan Done >>");
  241.     nl();
  242.     nl();
  243.   }
  244. }
  245.  
  246.  
  247.     7. Save MSGBASE1.C and load up BBS.C.  Search for void mainmenu()
  248.        and scroll down farther.  Make the changes as shown.
  249.  
  250.   if (strcmp(s,"/E")==0)
  251.     slash_e();
  252.   if ((strcmp(s,"/J")==0) && (lcs()))               /* MOD - ADD */
  253.     val_scan(cursub,1);                             /* MOD - ADD */
  254.   if (strcmp(s,"/N")==0)
  255.     nscan(cursub);
  256.  
  257.  
  258.     8. Search down and make these changes.
  259.  
  260.       case 'J':                                     /* MOD - ADD */
  261.         if (lcs()) {                                /* MOD - ADD */
  262.             express=0;                              /* MOD - ADD */
  263.             expressabort=0;                         /* MOD - ADD */
  264.             prt(2,"Scan all message bases?");       /* MOD - ADD */
  265.             if (yn())                               /* MOD - ADD */
  266.               val_scan(0,1);                        /* MOD - ADD */
  267.             else {                                  /* MOD - ADD */
  268.               i=0;                                  /* MOD - ADD */
  269.               vscan(cursub,&i);                     /* MOD - ADD */
  270.             }                                       /* MOD - ADD */
  271.         }                                           /* MOD - ADD */
  272.         break;                                      /* MOD - ADD */
  273.       case 'N':
  274.         express=0;
  275.         expressabort=0;
  276.         nscan(0);
  277.         break;
  278.  
  279.  
  280.     9.  Save BBS.C and load up FCNS.H.  Search for /*File: msgbase1.c*/
  281.          and make these changes...
  282.  
  283. void scan(int msgnum, int optype, int *nextsub);
  284. void qscan(int bn, int *ns);
  285. void nscan(int ss);
  286. void vscan(int bn, int *ns);                            /* MOD - ADD */
  287. void val_scan(int ss);                                  /* MOD - ADD */
  288. void scan2();
  289.  
  290.  
  291.     10. Make sure and add the 'J' and '/J' commands to your menu
  292.         files, menu number 0 & 5, I believe...
  293.  
  294.  
  295.     DISCLAIMER:  I make no guarantees with this mod whatsoever.
  296.     Your installation of the mod is your acceptance of any
  297.     damages caused to your hardware or software, incendental or
  298.     otherwise.
  299.  
  300.     PLEASE REPORT ALL BUGS!
  301.